package com.htzos.admin.system.service;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.htzos.admin.system.bean.SystemRoleBase;
import com.htzos.admin.system.dao.SystemRoleBaseMapper;
import com.htzos.admin.system.dao.SystemRoleMenuMapper;
import com.htzos.admin.system.dao.SystemUserroleBaseMapper;
import com.htzos.common.tool.ExtQueryBean;
@Service
@Transactional(rollbackFor = Exception.class)
public class SystemRoleBaseService {
	
	 @Autowired
	 SystemRoleMenuMapper systemRoleMenuMapper;
	 @Autowired
	 SystemUserroleBaseMapper systemUserroleBaseMapper;
    @Autowired
    SystemRoleBaseMapper systemRoleBaseMapper;
    @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
    public List<SystemRoleBase> systemRoleBaseList(SystemRoleBase systemRoleBase, ExtQueryBean extQuery){
       return systemRoleBaseMapper.systemRoleBaseList(systemRoleBase, extQuery);
    }

    @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
    public Integer systemRoleBaseTotal(SystemRoleBase systemRoleBase, ExtQueryBean extQuery){
       return systemRoleBaseMapper.systemRoleBaseTotal(systemRoleBase, extQuery);
    }

    @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
    public int systemRoleBaseUpdate(SystemRoleBase systemRoleBase){
       return systemRoleBaseMapper.systemRoleBaseUpdate(systemRoleBase);
    }

    @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
    public int systemRoleBaseInsert(SystemRoleBase systemRoleBase){
       return systemRoleBaseMapper.systemRoleBaseInsert(systemRoleBase);
    }

    @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
    public int systemRoleBaseDelete(SystemRoleBase systemRoleBase){
    	systemRoleMenuMapper.systemRoleMenuDeleteByRoleId(systemRoleBase.getRoleId());
    	systemUserroleBaseMapper.systemUserroleBaseDeleteByRoleId(systemRoleBase.getRoleId());
       return systemRoleBaseMapper.systemRoleBaseDelete(systemRoleBase);
    }

    @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
    public SystemRoleBase systemRoleBaseGet(Integer id){
       return systemRoleBaseMapper.systemRoleBaseGet(id);
    }
}